<!DOCTYPE html>
<!--
Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/dashboard/elements/revision-range.html">

<link rel="import" href="/tracing/core/test_utils.html">

<script>
'use strict';

tr.b.unittest.testSuite(function() {
  test('displayRevisionRange works with simple revision ranges', function() {
    const range = document.createElement('revision-range');
    assert.strictEqual(
        range.computeRevisionRange(20030, 20050), '20030 - 20050');
  });

  test('displayRevisionRange works with single revisions', function() {
    const range = document.createElement('revision-range');
    assert.strictEqual(range.computeRevisionRange(20030, 20030), '20030');
  });

  test('getDisplayRevisionRange formats Chrome/Chrome OS versions', function() {
    const range = document.createElement('revision-range');
    assert.strictEqual(
        range.computeRevisionRange(18120000539000000, 18120000539000000),
        'Cr 1812.0 / CrOS 5390.0.0');
  });

  test('getDisplayRevisionRange formats timestamps', function() {
    const range = document.createElement('revision-range');
    assert.strictEqual(
        range.computeRevisionRange(1420001111, 1420001111),
        '2014-12-31T04:45:11.000Z');
  });
});
</script>
